home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / SETUP / US / CBUILDER / DATA.Z / MAPI.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-13  |  19KB  |  497 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Simple MAPI Interface Unit                      }
  6. {                                                       }
  7. {       Copyright (c) 1996 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit Mapi;
  12.  
  13. interface
  14.  
  15. uses Windows;
  16.  
  17. {
  18.   Messaging Applications Programming Interface.
  19.  
  20.   Purpose:
  21.  
  22.     This file defines the structures and constants used by that
  23.     subset of the Messaging Applications Programming Interface
  24.     which is supported under Windows by Microsoft Mail for PC
  25.     Networks version 3.x.
  26. }
  27.  
  28. type
  29.   FLAGS = Cardinal;
  30.   {$nonamespace FLAGS}
  31.   LHANDLE = Cardinal;
  32.   {$nonamespace LHANDLE}
  33.   PLHANDLE = ^Cardinal;
  34.  
  35. const
  36.   lhSessionNull = (0);
  37.  
  38. type
  39.   PMapiFileDesc = ^TMapiFileDesc;
  40.   MapiFileDesc = packed record
  41.     ulReserved: Cardinal;        { Reserved for future use (must be 0)     }
  42.     flFlags: Cardinal;           { Flags                                   }
  43.     nPosition: Cardinal;         { character in text to be replaced by attachment }
  44.     lpszPathName: LPSTR;         { Full path name of attachment file       }
  45.     lpszFileName: LPSTR;         { Original file name (optional)           }
  46.     lpFileType: Pointer;         { Attachment file type (can be lpMapiFileTagExt) }
  47.   end;
  48.   {$nonamespace MapiFileDesc}
  49.   TMapiFileDesc = MapiFileDesc;
  50.  
  51. const
  52.   MAPI_OLE = $00000001; 
  53.   MAPI_OLE_STATIC = $00000002; 
  54.  
  55. type
  56.   PMapiFileTagExt = ^TMapiFileTagExt;
  57.   MapiFileTagExt = packed record 
  58.     ulReserved: Cardinal;       { Reserved, must be zero.                  }
  59.     cbTag: Cardinal;            { Size (in bytes) of                       }
  60.     lpTag: PByte;               { X.400 OID for this attachment type       }
  61.     cbEncoding: Cardinal;       { Size (in bytes) of                       }
  62.     lpEncoding: PByte;          { X.400 OID for this attachment's encoding }
  63.   end;
  64.   {$nonamespace MapiFileTagExt}
  65.   TMapiFileTagExt = MapiFileTagExt;
  66.  
  67.   PMapiRecipDesc = ^TMapiRecipDesc;
  68.   MapiRecipDesc = packed record 
  69.     ulReserved: Cardinal;       { Reserved for future use                  }
  70.     ulRecipClass: Cardinal;     { Recipient class                          }
  71.                                 { MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG    }
  72.     lpszName: LPSTR;            { Recipient name                           }
  73.     lpszAddress: LPSTR;         { Recipient address (optional)             }
  74.     ulEIDSize: Cardinal;        { Count in bytes of size of pEntryID       }
  75.     lpEntryID: Pointer;         { System-specific recipient reference      }
  76.   end;
  77.   {$nonamespace MapiRecipDesc}
  78.   TMapiRecipDesc = MapiRecipDesc;
  79.  
  80. const
  81.   MAPI_ORIG = 0;                { Recipient is message originator          }
  82.   MAPI_TO = 1;                  { Recipient is a primary recipient         }
  83.   MAPI_CC = 2;                  { Recipient is a copy recipient            }
  84.   MAPI_BCC = 3;                 { Recipient is blind copy recipient        }
  85.  
  86. type
  87.   PMapiMessage = ^TMapiMessage;
  88.   MapiMessage = packed record
  89.     ulReserved: Cardinal;         { Reserved for future use (M.B. 0)       }
  90.     lpszSubject: LPSTR;           { Message Subject                        }
  91.     lpszNoteText: LPSTR;          { Message Text                           }
  92.     lpszMessageType: LPSTR;       { Message Class                          }
  93.     lpszDateReceived: LPSTR;      { in YYYY/MM/DD HH:MM format             }
  94.     lpszConversationID: LPSTR;    { conversation thread ID                 }
  95.     flFlags: FLAGS;               { unread,return receipt                  }
  96.     lpOriginator: PMapiRecipDesc; { Originator descriptor                  }
  97.     nRecipCount: Cardinal;        { Number of recipients                   }
  98.     lpRecips: PMapiRecipDesc;     { Recipient descriptors                  }
  99.     nFileCount: Cardinal;         { # of file attachments                  }
  100.     lpFiles: PMapiFileDesc;       { Attachment descriptors                 }
  101.   end;
  102.   {$nonamespace MapiMessage}
  103.   TMapiMessage = MapiMessage;
  104.  
  105. const
  106.   MAPI_UNREAD = $00000001; 
  107.   MAPI_RECEIPT_REQUESTED = $00000002; 
  108.   MAPI_SENT = $00000004; 
  109.  
  110. { Entry points. }
  111.  
  112. { flFlags values for Simple MAPI entry points. All documented flags are
  113.   shown for each call. Duplicates are commented out but remain present
  114.   for every call. }
  115.  
  116. { MAPILogon() flags. }
  117.  
  118.   MAPI_LOGON_UI = $00000001;                { Display logon UI             }
  119.   MAPI_PASSWORD_UI = $00020000;             { prompt for password only     }
  120.   MAPI_NEW_SESSION = $00000002;             { Don't use shared session     }
  121.   MAPI_FORCE_DOWNLOAD = $00001000;          { Get new mail before return   }
  122.   MAPI_ALLOW_OTHERS = $00000008;            { Make this a shared session   }
  123.   MAPI_EXPLICIT_PROFILE = $00000010;        { Don't use default profile    }
  124.   MAPI_EXTENDED = $00000020;                { Extended MAPI Logon          }
  125.   MAPI_USE_DEFAULT = $00000040;             { Use default profile in logon }
  126.  
  127.   MAPI_SIMPLE_DEFAULT = MAPI_LOGON_UI or MAPI_FORCE_DOWNLOAD or MAPI_ALLOW_OTHERS; 
  128.   MAPI_SIMPLE_EXPLICIT = MAPI_NEW_SESSION or MAPI_FORCE_DOWNLOAD or MAPI_EXPLICIT_PROFILE; 
  129.  
  130. { MAPILogoff() flags.      }
  131.  
  132.   MAPI_LOGOFF_SHARED = $00000001;           { Close all shared sessions    }
  133.   MAPI_LOGOFF_UI = $00000002;               { It's OK to present UI        }
  134.  
  135. { MAPISendMail() flags.    }
  136.  
  137. { #define MAPI_LOGON_UI        0x00000001     Display logon UI             }
  138. { #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     }
  139.   MAPI_DIALOG = $00000008;                  { Display a send note UI       }
  140. { # define MAPI_USE_DEFAULT     0x00000040     Use default profile in logon }
  141.  
  142. { MAPIFindNext() flags.    }
  143.  
  144.   MAPI_UNREAD_ONLY = $00000020;             { Only unread messages         }
  145.   MAPI_GUARANTEE_FIFO = $00000100;          { use date order               }
  146.   MAPI_LONG_MSGID = $00004000;              { allow 512 char returned ID   }
  147.  
  148. { MAPIReadMail() flags.    }
  149.  
  150.   MAPI_PEEK = $00000080;                    { Do not mark as read.         }
  151.   MAPI_SUPPRESS_ATTACH = $00000800;         { header + body, no files      }
  152.   MAPI_ENVELOPE_ONLY = $00000040;           { Only header information      }
  153.   MAPI_BODY_AS_FILE = $00000200; 
  154.  
  155. { MAPISaveMail() flags.    }
  156.  
  157. { #define MAPI_LOGON_UI        0x00000001     Display logon UI             }
  158. { #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     }
  159. { #define MAPI_LONG_MSGID      0x00004000  /* allow 512 char returned ID   }
  160.  
  161. { MAPIAddress() flags.     }
  162.  
  163. { #define MAPI_LOGON_UI        0x00000001     Display logon UI             }
  164. { #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     }
  165.  
  166. { MAPIDetails() flags.     }
  167.  
  168. { #define MAPI_LOGON_UI        0x00000001     Display logon UI             }
  169. { #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     }
  170.   MAPI_AB_NOMODIFY = $00000400;             { Don't allow mods of AB entries }
  171.  
  172. { MAPIResolveName() flags. }
  173.  
  174. { #define MAPI_LOGON_UI        0x00000001     Display logon UI             }
  175. { #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     }
  176. { #define MAPI_DIALOG          0x00000008     Prompt for choices if ambiguous }
  177. { #define MAPI_AB_NOMODIFY     0x00000400     Don't allow mods of AB entries }
  178.  
  179. type
  180.   PFNMapiLogon = ^TFNMapiLogOn;
  181.   TFNMapiLogOn = function(ulUIParam: Cardinal; lpszProfileName: LPSTR; 
  182.     lpszPassword: LPSTR; flFlags: FLAGS; ulReserved: Cardinal; 
  183.     lplhSession: PLHANDLE): Cardinal stdcall;
  184.  
  185.   PFNMapiLogOff = ^TFNMapiLogOff;
  186.   TFNMapiLogOff = function(lhSession: LHANDLE; ulUIParam: Cardinal; flFlags: FLAGS;
  187.     ulReserved: Cardinal): Cardinal stdcall;
  188.  
  189.   PFNMapiSendMail = ^TFNMapiSendMail;
  190.   TFNMapiSendMail = function(lhSession: LHANDLE; ulUIParam: Cardinal;
  191.     var lpMessage: TMapiMessage; flFlags: FLAGS;
  192.     ulReserved